Skip to content

Conversation

@CagtayFabry
Copy link
Member

Currently, the library uses the ologin function open Openbis sessions in various places. ologin is dependent on a specific environmental variables.

To allow more flexible use of the library, this small patch enables the user to pass through existing Openbis sessions that might have been opened in a different context.

@CagtayFabry
Copy link
Member Author

@JosePizarro3 I tried to keep the function "as is" for compatibility.

There are a few places of lines similar to this

class OpenbisEntities:
    def __init__(self, url: str = ""):
        self.openbis = ologin(url=url)

I think to keep compatibility high it would make sense to move away from this pattern into something more general where sessions can be provided, e.g.

class OpenbisEntities:
    def __init__(self, openbis: Openbis | str = None):
        self.openbis = ologin(url=openbis)

The default behaviour could replicate the current use of environmental variables.

Of course we could stick with the url argument name but I think this might be confusion later.

Let me know what you think

Copy link
Member

@JosePizarro3 JosePizarro3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good to me.

If you want, feel free to change url to whatever other variable name you feel it is more appropiate. You just need to grep all appearances of ologin in bam_masterdata and tests, tho I don't think there are many.

@JosePizarro3 JosePizarro3 added the enhancement Enhancements on the code base label Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Enhancements on the code base

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants